<#include "/common/h-ui-base-css.html">
<#include "/common/h-ui-base-js.html">
<#include "/common/validation-js.html">
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center" ><span class="c-red">*</span>显示名称：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" autocomplete="off" value="${user.nickname!}" placeholder="" id="nickname" name="nickname">
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2" style="text-align: center" ><span class="c-red">*</span>密码：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="password" class="input-text" autocomplete="off" value="" placeholder="" id="password" name="password">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2" style="text-align: center" >确认密码：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="password" class="input-text" autocomplete="off" value="" placeholder="" id="password2" name="password2" >
            </div>
        </div>
		<input type="text" hidden id="flag" name="flag" value="flag">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2" style="text-align: center" >用户快捷：</label>
            <div class="formControls col-xs-8 col-sm-10 skin-minimal">
				<#list shortInfo as short>
					<div class="check-box">
						<input type="checkbox" <#if short.check == "checked">checked="checked"</#if> id="${short.checkBoxName}" name="${short.checkBoxName}">
						<label for="checkbox-5">${short.menuName}</label>
					</div>
				</#list>
            </div>
        </div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
		</div>
	</div>
	</form>
</article>
<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">

	$(function(){
	var id = ${user.id!-1};
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#form-admin-add").validate({
		rules:{
            nickname:{
				required:true,
                minlength:2,
                maxlength:16
			},
            password2:{
                equalTo: "#password"
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: "/user-ins-upd-del/"+id ,
				data :$("form-admin-add").serialize(),
				async:false,
				success: function(data){
					layer.msg('添加成功!',{icon:1,time:1000});
                    window.location.href = "/main";
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('error!',{icon:1,time:1000});
				}
			});
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
